#include <iostream>
#include <string>
#include <fstream>
#include <map>
#include <stdlib.h>
#include <algorithm>

using namespace std;

class GameLibrary
    {
    public:
    GameLibrary();
    ~GameLibrary(){}
    
    void LoadLibrary();
    void ParseConf();
    void AddGame();
    
    //Number, Game/Scriptname, Imagename
    std::map<int, std::pair <std::string, std::string> > Games;
    std::map<int, std::pair <std::string, std::string> >::iterator itGames;
    
    int LatestGameNr;
    std::string TempGameName;
    std::string TempGamePic;
    
    	// Trim Functions
	// trim from start
	static std::string &ltrim(std::string &s)
	{
	    s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
	    return s;
	}

	// trim from end
	static std::string &rtrim(std::string &s)
	{
	    s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
	    return s; 
	}

	// trim from both ends
	static std::string &trim(std::string &s)
	{
	    return ltrim(rtrim(s));
	}
    };
